package Hbase;


import java.io.IOException;

import org.apache.hadoop.conf.Configuration;
import org.apache.hadoop.hbase.HBaseConfiguration;
import org.apache.hadoop.hbase.client.HTable;
import org.apache.hadoop.hbase.client.Put;
import org.apache.hadoop.hbase.util.Bytes;
import pojo.ST;


public class update {
    public update(ST Information) throws IOException {
        System.out.println("acc");
        Configuration conf = HBaseConfiguration.create();
        conf.set("hbase.zookeeper.quorum", "192.168.239.200");

        ST list=Information;
        String ID=list.getStudentID();
        String name=list.getStudentName();
        String number=list.getStudentNumber();
        String status=list.getStudentStatus();

        System.out.println(ID);
        HTable table = new HTable(conf,"student");

        Put put1 = new Put(Bytes.toBytes(ID));
        put1.add(Bytes.toBytes("info"), Bytes.toBytes("ContactNumber"), Bytes.toBytes(number));

        put1.add(Bytes.toBytes("info"), Bytes.toBytes("Name"), Bytes.toBytes(name));

        put1.add(Bytes.toBytes("status"), Bytes.toBytes("StudentStatus"), Bytes.toBytes(status));
        table.put(put1);
        System.out.println("更新成功");

    }
}
